package com.zhc.dejingapi.job;

import com.zhc.dejingapi.service.upload.IQingAppFieldService;
import com.zhc.dejingapi.service.upload.IQingAppInfoService;
import com.zhc.dejingapi.service.upload.IQingFlowDataDownloadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

@Slf4j
@Configuration
public class QingSfcBaseInfoDownJob {
    private  static  boolean isRunning=false;
    private final JdbcTemplate mysqlJdbcTemplate;
    private final IQingAppInfoService qqingAppInfoService;
    private final IQingAppFieldService qqingAppFieldService;
    private final IQingFlowDataDownloadService QingFlowDataDownloadService;

    public QingSfcBaseInfoDownJob(@Qualifier("mySqlJdbcTemplate")JdbcTemplate mysqlJdbcTemplate1,
                                  IQingAppInfoService qqingAppInfoService1,
                                  IQingAppFieldService qqingAppFieldService1,
                                  IQingFlowDataDownloadService qingFlowDataDownloadService1) {
        this.mysqlJdbcTemplate = mysqlJdbcTemplate1;
        this.qqingAppInfoService = qqingAppInfoService1;
        this.qqingAppFieldService = qqingAppFieldService1;
        QingFlowDataDownloadService = qingFlowDataDownloadService1;
    }

    public  void executeJob(){

        if(isRunning){
            log.info("ERPProdClassToQingJob is running");
            return;
        }

        isRunning=true;
        int i=1;
        if(i==10){
            try {

                QingFlowDataDownloadService.downWorkShift();

            }
            catch (Exception e){
                e.printStackTrace();
                log.error("ERPProdClassToQingJob error",e);
            }
        }


        isRunning=false;
    }

}
